To inform the Host of the results of processing, the HSM sends a message containing all the necessary information as a sequence of characters on the communications link. A response message is generated for each of the following:
· In response to a command.
· As a second response to a print command after the HSM has finished sending the print data to the printer.
· In response to the entry of PIN solicitation data at the Console (but only after the Host has enabled this function).
Each response from the HSM consists of the following:
· Start of text character (if applicable).
· Message header.
· Response code.
· Error code.
· Data elements.
· Message trailer.
· End of text character (if applicable).

The Start of Text (STX) character indicates the start of a valid message. The ASCII and EBCDIC value is X'02. The STX character is not used in SNA-SDLC, ESCON or TCP/IP environments.
The message header field is a copy of the field received in the command message from the Host. The data is returned to the Host unchanged.
It can be used to label commands and their responses for systems that implement batch queues or which multi-thread commands.
Every response has a unique two-character code. Normally this code has the same first character as the command to which it is a response, and the second character is one greater than the second character of the command (e.g., if the command code is AA, the response code is AB). The value of each code is detailed in the Host Command Reference Manual.
The two-character error code field is used by the HSM to report errors detected during processing. The values are always numeric and the value 00 indicates that no errors have been found. If an error (other than 00) is returned, subsequent fields, with the exception of the end of text character, are not returned by the HSM. Error codes specific to a command or frequently returned with a command are listed with the command code in the Host Command Reference Manual. A list of global errors is also included in the Host Command Reference Manual.
Many HSM commands return data as a result of the processing. Details of the contents of the returned data are given in the Host Command Reference Manual. Generally, data is not returned for error codes other than 00. There are some exceptions to this rule, for example the Key Import command (A6) returns error code 01 to advise that the key being imported is not odd parity.
The message trailer (EM) field is present only if it was present in the command message, and it is returned unchanged. It is not returned for error codes other than 00.
The End of Text (ETX) field indicates the end of the response message from the HSM. In a bisynchronous system its ASCII and EBCDIC value is X'03. The End of Text field is not used in SNA-SDLC, ESCON or TCP/IP environments.
In an asynchronous system it can be configured to be one or two characters in length, and the value of each of the characters is configurable (normally at installation time).